package com.heima.admin.apclient;

import com.heima.apis.admin.WmSensitiveClient;
import com.heima.model.admin.dtos.ChannelDto;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmChannel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1")
public class AdClient {
    @Autowired
    private WmSensitiveClient sensitiveClient;

    @PostMapping("/sensitive/list")
    public ResponseResult list(@RequestBody SensitiveDto dto) {
        return sensitiveClient.list(dto);
    }

    @PostMapping("/channel/list")
    public ResponseResult list(@RequestBody ChannelDto dto){
        return sensitiveClient.list(dto);
    }

    @PostMapping("/channel/save")
    public ResponseResult save(@RequestBody WmChannel wmChannel){
        return sensitiveClient.save(wmChannel);
    }

    @GetMapping("/channel/del/{id}")
    public ResponseResult delete(@PathVariable Integer id){
        return sensitiveClient.delete(id);
    }

    @PostMapping("/channel/update")
    public ResponseResult update(@RequestBody WmChannel wmChannel){
        return sensitiveClient.update(wmChannel);
    }

}